import cn.pzhuWEB.llk.dao.ICardDao;
import cn.pzhuWEB.llk.entity.Card;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;

/**
 * @ClassName Tst
 * @Description TODO
 * @Date 2021/11/8 21:38
 **/
public class Tst {

    @Test
   public void test() throws IOException {
        InputStream is = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactoryBuilder sqlSessionFactoryBuilder = new SqlSessionFactoryBuilder();
        SqlSessionFactory sqlsessionFactory = sqlSessionFactoryBuilder.build(is);
        SqlSession sqlSession = sqlsessionFactory.openSession(true);
        ICardDao mapper = sqlSession.getMapper(ICardDao.class);
        ArrayList<Card> all = mapper.findAll();
        System.out.println(all);
   }
}
